define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_addressSave(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"addr_id": "001"},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}
		
		//返回信息
		return {
			//地址增加
			address_save: function(name,mobile,zipcode,region_id,addr,addr_id,def_addr, callback) {
				//post请求
				Http.post({
					method: 'member.address.saveaddr',
					name: name,
					mobile: mobile,
					zipcode: zipcode,
					region_id: region_id,
					addr: addr,
					addr_id: addr_id,
					def_addr:def_addr
				}, function(result) {
					if(callback)
						callback(get_data_addressSave(result));
				}, function(e) {

				}, function() {

				});
			},
			//详情
			address_detail:function(addr_id,callback){
				Http.post({
					method:'member.address.detail',
					addr_id:addr_id
				},function(result){
					if(callback)
					callback(result.result);
				},function(e){
					
				},function(){
					
				})
			}
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("T_address_add", factory);
});